//
//  DataHeaderView.m
//  YouinRTCDemo
//
//  Created by 潘欣 on 2025/6/4.
//

#import "DataHeaderView.h"

@interface DataHeaderView ()
@property (nonatomic,strong)UILabel *fangwenLabel;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *bgArray;
@property (nonatomic,strong)UIImageView *fangwenImg;
@end
@implementation DataHeaderView


- (instancetype)initWithFrame:(CGRect)frame
{
    if ([super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        self.dataArray = [NSMutableArray arrayWithObjects:@"访问",@"分享",@"互动",@"交易", nil];
        self.bgArray = [NSMutableArray arrayWithObjects:@"fangwen_icon",@"fenxiang_bg",@"hudong_img",@"jiaoyi_bg", nil];
        self.fangwenImg = [[UIImageView alloc] init];
        
        [self addSubview:self.fangwenImg];
        
        [self.fangwenImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.width.mas_equalTo(self);
            make.height.offset(36);
        }];
        
        self.fangwenLabel = [[UILabel alloc] init];
        self.fangwenLabel.textColor =RYColorForHex(@"#333333");
        self.fangwenLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.fangwenLabel];
        
        [self.fangwenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.fangwenImg).offset(40);
            make.centerY.mas_equalTo(self.fangwenImg);
        }];
    }
    return self;
}

- (void)setIndex:(NSInteger)index
{
    _index = index;
    self.fangwenLabel.text = self.dataArray[index];
    self.fangwenImg.image = [UIImage imageNamed:self.bgArray[index]];
}


@end
